package com.zsk.shop.enums;

import com.zsk.shop.common.enums.SmsEnum;

/**
 * // 0注册 1登录 2···
 * 这个code 需同步SmsEnum
 * {@link SmsEnum}
 */
public enum EnumVerificationType {
    REG("注册", 0),
    LOGIN("登录", 1),
    BING_PHONE("换绑手机", 2),
    CHANGE_PWD("换密码", 3),
    LOGIN_REG("登录/注册", 4);

    String name;
    Integer code;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    EnumVerificationType(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static String getNameByCode(Integer code) {
        EnumVerificationType[] enums = EnumVerificationType.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getCode().equals(code)) {
                return enums[i].getName();
            }
        }
        return "";
    }
}
